package com.cleaningcloud.cld.controller;

import com.cleaningcloud.cld.domain.MaterialsBI;
import com.cleaningcloud.cld.service.IMaterialsBIService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @className 资产物资BI控制类
 * @description //TODO
 * @author Shaw
 * @date: 2025-03-05 17:07
 * @param: //TODO
 */ 
@RestController
@RequestMapping("/materialsBI")
public class MaterialsBIController extends BaseController {

    //BI业务接口
    @Autowired
    private IMaterialsBIService iMaterialsBIService;

    /**
     * @Author Shaw
     * @Description 库存统计表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getStockStatisticsTable")
    public AjaxResult getStockStatisticsTable() {
        return success(iMaterialsBIService.getStockStatisticsTable());
    }

    /**
     * @Author Shaw
     * @Description 物资类别库存数量占比图
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCommodityTypeRate")
    public AjaxResult getCommodityTypeRate() {
        return success(iMaterialsBIService.getCommodityTypeRate());
    }

    /**
     * @Author Shaw
     * @Description 按当月查询物资资产成本(日走势图)
     * @date: 2025-03-06 16:37
     * @param: //TODO
     */
    @GetMapping("/getMaterialsInfoCostDayImg")
    public AjaxResult getMaterialsInfoCostDayImg() {
        return success(iMaterialsBIService.getMaterialsInfoCostDayImg());
    }

    /**
     * @Author Shaw
     * @Description 按当月查询物资资产成本(月累计表格)
     * @date: 2025-03-06 16:37
     * @param: //TODO
     */
    @GetMapping("/getMaterialsInfoCostTable")
    public AjaxResult getMaterialsInfoCostTable() {
        return success(iMaterialsBIService.getMaterialsInfoCostTable());
    }

    /**
     * @Author Shaw
     * @Description 采购订单商品类型库存数量占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getProcureCommodityTypeRate")
    public AjaxResult getProcureCommodityTypeRate() {
        return success(iMaterialsBIService.getProcureCommodityTypeRate());
    }

    /**
     * @Author Shaw
     * @Description 采购订单不同状态订单数表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getProcureNumberInfoTable")
    public AjaxResult getProcureNumberInfoTable() {
        return success(iMaterialsBIService.getProcureNumberInfoTable());
    }

    /**
     * @Author Shaw
     * @Description 物资品类消耗占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getMaterialsConsumeRate")
    public AjaxResult getMaterialsConsumeRate() {
        return success(iMaterialsBIService.getMaterialsConsumeRate());
    }

    /**
     * @Author Shaw
     * @Description 物资品类消耗数量表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getMaterialsConsumeTable")
    public AjaxResult getMaterialsConsumeTable() {
        return success(iMaterialsBIService.getMaterialsConsumeTable());
    }

    /**
     * @Author Shaw
     * @Description 项目业态物资调拨单数量占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getMaterialsAllocateRate")
    public AjaxResult getMaterialsAllocateRate() {
        return success(iMaterialsBIService.getMaterialsAllocateRate());
    }

    /**
     * @Author Shaw
     * @Description 配送订单不同状态订单数表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getMaterialsAllocateNumberInfoTable")
    public AjaxResult getMaterialsAllocateNumberInfoTable() {
        return success(iMaterialsBIService.getMaterialsAllocateNumberInfoTable());
    }

    /**
     * @Author Shaw
     * @Description 三级库商品分类库存数量占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getLevelStockCommodityTypeRate")
    public AjaxResult getLevelStockCommodityTypeRate(Long wareType) {
        return success(iMaterialsBIService.getLevelStockCommodityTypeRate(wareType));
    }

    /**
     * @Author Shaw
     * @Description 根据类型ID获取三级库存数量/金额占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getLevelCommodityTypeRateByCommodityTypeId")
    public AjaxResult getLevelCommodityTypeRateByCommodityTypeId(MaterialsBI materialsBI) {
        return success(iMaterialsBIService.getLevelCommodityTypeRateByCommodityTypeId(materialsBI));
    }

    /**
     * @Author Shaw
     * @Description 根据类型ID获取三级库存数量/金额TOP10
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getLevelCommodityTypeTableByCommodityTypeId")
    public AjaxResult getLevelCommodityTypeTableByCommodityTypeId(MaterialsBI materialsBI) {
        return success(iMaterialsBIService.getLevelCommodityTypeTableByCommodityTypeId(materialsBI));
    }

    /**
     * @Author Shaw
     * @Description 资产维修金额占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getAssetsRepairRate")
    public AjaxResult getAssetsRepairRate() {
        return success(iMaterialsBIService.getAssetsRepairRate());
    }

    /**
     * @Author Shaw
     * @Description 根据项目/区域查询资产状态信息表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getProjectAssetsInfoTable")
    public AjaxResult getProjectAssetsInfoTable(Long paramType) {
        return success(iMaterialsBIService.getProjectAssetsInfoTable(paramType));
    }

    /**
     * @Author Shaw
     * @Description 根据资产查询资产状态信息列表
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getAssetsInfoList")
    public TableDataInfo getAssetsInfoList() {
        startPage();
        List<MaterialsBI> list = iMaterialsBIService.getAssetsInfoList();
        return getDataTable(list);
    }

    /**
     * @Author Shaw
     * @Description 按项目区域查询物资品类消耗数量图
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getProjectRegionMaterialsTypeConsumeImg")
    public AjaxResult getProjectRegionMaterialsTypeConsumeImg() {
        return success(iMaterialsBIService.getProjectRegionMaterialsTypeConsumeImg());
    }

        /**
         * @Author Shaw
         * @Description 按项目区域汇总物资品类消耗占比
         * @date: 2025-04-09 12:06
         * @param: //TODO
         */
    @GetMapping("/getMaterialsTypeConsumeRateByProjectRegion")
    public AjaxResult getMaterialsTypeConsumeRateByProjectRegion(Long commodityTypeId) {
        return success(iMaterialsBIService.getMaterialsTypeConsumeRateByProjectRegion(commodityTypeId));
    }

    /**
     * @Author Shaw
     * @Description 按物资消耗数量TOP10
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getMaterialsConsumeTopTable")
    public AjaxResult getMaterialsConsumeTopTable(Long commodityTypeId) {
        return success(iMaterialsBIService.getMaterialsConsumeTopTable(commodityTypeId));
    }

    /**
     * @Author Shaw
     * @Description 按项目查询物资品类消耗数量表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getProjectMaterialsTypeConsumeTable")
    public AjaxResult getProjectMaterialsTypeConsumeTable() {
        return success(iMaterialsBIService.getProjectMaterialsTypeConsumeTable());
    }

    /**
     * @Author Shaw
     * @Description 当月采购日度订单数量走势图
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getProcureOrderByDayImg")
    public AjaxResult getProcureOrderByDayImg() {
        return success(iMaterialsBIService.getProcureOrderByDayImg());
    }

    /**
     * @Author Shaw
     * @Description 按供应商查询采购订单状态数量/金额表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getSupplierProjectOrderStatusInfoTable")
    public AjaxResult getSupplierProjectOrderStatusInfoTable() {
        return success(iMaterialsBIService.getSupplierProjectOrderStatusInfoTable());
    }

    /**
     * @Author Shaw
     * @Description 按物资品类区分采购数量占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCommodityTypeProduceNumberRate")
    public AjaxResult getCommodityTypeProduceNumberRate() {
        return success(iMaterialsBIService.getCommodityTypeProduceNumberRate());
    }

    /**
     * @Author Shaw
     * @Description 按物资品类区分采购金额占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCommodityTypeProduceMoneyRate")
    public AjaxResult getCommodityTypeProduceMoneyRate() {
        return success(iMaterialsBIService.getCommodityTypeProduceMoneyRate());
    }

    /**
     * @Author Shaw
     * @Description 按物资品类查询采购订单状态数量/金额表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getSupplierCommodityTypeProjectOrderStatusInfoTable")
    public AjaxResult getSupplierCommodityTypeProjectOrderStatusInfoTable() {
        return success(iMaterialsBIService.getSupplierCommodityTypeProjectOrderStatusInfoTable());
    }

    /**
     * @Author Shaw
     * @Description 配送订单项目区域调拨数量占比
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getProjectRegionAllocateRate")
    public AjaxResult getProjectRegionAllocateRate() {
        return success(iMaterialsBIService.getProjectRegionAllocateRate());
    }

    /**
     * @Author Shaw
     * @Description 当月采购日度订单数量走势图
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getAllocateOrderByDayImg")
    public AjaxResult getAllocateOrderByDayImg() {
        return success(iMaterialsBIService.getAllocateOrderByDayImg());
    }

    /**
     * @Author Shaw
     * @Description 按项目物资品类查询配送订单信息表格
     * @date: 2025-04-09 12:06
     * @param: //TODO
     */
    @GetMapping("/getCommodityTypeAllocateOrderStatusInfoTable")
    public AjaxResult getCommodityTypeAllocateOrderStatusInfoTable() {
        return success(iMaterialsBIService.getCommodityTypeAllocateOrderStatusInfoTable());
    }
}
